<?php
/*
* Example: Send SMS ang Getting Delivery Status of it.
*/

error_reporting(E_ALL);  

// Select only one of this
include_once "../src/mmsRESTlibraryXML.php";
//include_once "../src/mmsRESTlibraryJSON.php";
//include_once "../src/mmsRESTlibraryURLEnc.php";

//$mmsClient = new mmsRESTclient($spId,$serviceId,$spPassword,$token,$requestor_id,$apiendpoint);
$mmsClient = new mmsRESTclient("000154","0102129606","123456","o3H85j7c3","525514009846","https://200.39.21.12:8443/osg/UNICA-MMS-REST");

//Disable SSL validation
$mmsClient->CertificateValidation(0);

//Set up mandatory parameters
$address["phoneNumber"]="525515385391";

//Adding Attchaments
if (!$mmsClient->AddAttachment('Text.txt','','8bit','text/plain')) echo "\nThere was an error adding File to MMS";
if (!$mmsClient->AddAttachment('Video.3gp','','base64','video/3gp')) echo "\nThere was an error adding File to MMS";


//Send wap push message
$result =  $mmsClient->sendMMS($address);

//Checking response
$protocol=explode (":",strtolower($result));
if ($protocol == 'http' || $protocol == 'https'){
            //Getting Delivery Status
            $deliveryStatus =  $mmsClient->getMessageDeliveryStatus($result); 
            echo $deliveryStatus;
    }
else {
        //An error ocurred
        echo $result;    
        }

?>

